<?php
/**
 * 分类表数据模型
 * @author 齐迹  email:smpss2012@gmail.com
 */
class m_cangku extends base_m
{
    public function primarykey()
    {
        return 'id';
    }
    public function tableName()
    {
        return base_Constant::TABLE_PREFIX . 'cangku';
    }
    public function relations()
    {
        return array();
    }
    public function create($data)
    {
        if (!$data['cangku_name']) {
            $this->setError(0, "缺少必要参数");
            return false;
        }
        if ($data['pid']) {
            $this->set("id", $data['pid']);
        }
        $this->set("cangku_name", $data['cangku_name']);
        $rs = $this->save($data['id']);
        if ($rs) {
            return $rs;
        }

        $this->setError(0, "保存数据失败" . $this->getError());
        return false;
    }
}
